// Package main
// Created by GoLand
// @User: lenora
// @Date: 2023/11/23
// @Time: 17:06

package main

import "fmt"

func Struct() {
	u1 := Users{}
	fmt.Printf("%v\n", u1)  //{"" 0}
	fmt.Printf("%+v\n", u1) //{name:"" age:0}

	//两个u2的值是不同的
	//new可以理解为Go会为变量分配内存,并且把变量中的值的内存都置为0
	u2 := new(Users)
	fmt.Printf("%p\n", u2)
	u2 = &Users{}
	fmt.Printf("%p\n", u2)
}

type Users struct {
	name string
	age  int
}
